﻿<MPL:BaseFadeDialog x:Class="SSDM.NewEntry"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:MyControl="clr-namespace:MPL.MyControls;assembly=MPL"
    xmlns:MPL="clr-namespace:MPL;assembly=MPL"
    x:Name="MySelf" ShowInTaskbar="True"
    xmlns:CommonControl="clr-namespace:SSDM.CommonUI"
    Title="" Height="330" Width="641">
    <MPL:BaseFadeDialog.Resources>
        <Storyboard x:Key="appendixPanelStoryStart" x:Name="appendixPanelStoryStart">
            <DoubleAnimation To="120" From="0" Duration="00:00:00.5" AccelerationRatio="0.3" DecelerationRatio="0.7"
                Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="appendixPanel"
                />
            <DoubleAnimation By="120" Duration="00:00:00.5" AccelerationRatio="0.3" DecelerationRatio="0.7"
                Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="MySelf"
                />
        </Storyboard>
        <Storyboard x:Key="appendixPanelStoryEnd" x:Name="appendixPanelStoryEnd">
            <DoubleAnimation To="0" Duration="00:00:00.5" AccelerationRatio="0.3" DecelerationRatio="0.7"
                Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="appendixPanel"
                />
            <DoubleAnimation By="-120" Duration="00:00:00.5" AccelerationRatio="0.3" DecelerationRatio="0.7"
                Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="MySelf"
                />
        </Storyboard>
        <Storyboard x:Key="MaskLayerFadeStory_Start" x:Name="MaskLayerFadeStory_Start">
            <DoubleAnimation By="0.95" From="0.1" Duration="00:00:00.5"
                Storyboard.TargetProperty="(FrameworkElement.Opacity)" Storyboard.TargetName="maskLayer"
                />
        </Storyboard>
        <Storyboard x:Key="MaskLayerFadeStory_End" x:Name="MaskLayerFadeStory_End">
            <DoubleAnimation From="0.95" To="0" Duration="00:00:01"
                Storyboard.TargetProperty="(FrameworkElement.Opacity)" Storyboard.TargetName="maskLayer"
                />
        </Storyboard>
    </MPL:BaseFadeDialog.Resources>
    <Grid>
        <DockPanel Panel.ZIndex="1">
            <MyControl:ScrollableListBox DockPanel.Dock="Top"
                    Height="150" Panel.ZIndex="1"
                                          ScrollViewer.IsDeferredScrollingEnabled="False"
                         ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="5,20,5,2"
                ItemsSource="{Binding}" x:Name="DbCollectionList" >
                <MyControl:ScrollableListBox.BitmapEffect>
                    <BlurBitmapEffect Radius="0.5" KernelType="Box" />
                </MyControl:ScrollableListBox.BitmapEffect>
                <MyControl:ScrollableListBox.BorderBrush>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Color="Transparent" Offset="0.0" />
                        <GradientStop Color="SkyBlue" Offset="0.25" />
                        <GradientStop Color="SkyBlue" Offset="0.75" />
                        <GradientStop Color="Transparent" Offset="1.0" />
                    </LinearGradientBrush>
                </MyControl:ScrollableListBox.BorderBrush>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Width="80" Height="Auto"
                            Tag="{Binding Path=NewURL}"
                                    MouseLeftButtonDown="Border_MouseLeftButtonDown"
                                    MouseEnter="Border_MouseEnter"
                                    MouseLeave="Border_MouseLeave"
                        Margin="10">
                            <StackPanel>
                                <Image Source="{Binding Path=LogoImage}" 
                                       PreviewMouseLeftButtonDown="Image_PreviewMouseLeftButtonDown_ForEntry"
                                       Tag="{Binding Path=NewURL}" Height="60">
                                    <Image.ToolTip>
                                        <StackPanel Opacity="0.8">
                                            <TextBlock Text="{Binding Path=ToolTipText}"/>
                                        </StackPanel>
                                    </Image.ToolTip>
                                </Image>
                                <TextBlock Text="{Binding Path=Comment}" HorizontalAlignment="Center"></TextBlock>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal"></VirtualizingStackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </MyControl:ScrollableListBox>
            <MyControl:ScrollableListBox x:Name="themeListBox" DockPanel.Dock="Top"
                                             BorderThickness="5,20,5,20"
                                             ItemsSource="{Binding}"
                         ScrollViewer.IsDeferredScrollingEnabled="False"
                         ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     ScrollViewer.VerticalScrollBarVisibility="Visible">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Width="20" Height="Auto"
                                    MouseEnter="Border_MouseEnter_Theme"
                                    MouseLeave="Border_MouseLeave_Theme"
                        Margin="15">
                            <StackPanel>
                                <Image Source="{Binding Path=ThemeIcon}"
                                           Tag="{Binding}" 
                                           PreviewMouseLeftButtonDown="Image_PreviewMouseLeftButtonDown"
                                           Height="20">
                                    <Image.ToolTip>
                                        <StackPanel>
                                            <TextBlock Text="{Binding ThemeName}"></TextBlock>
                                        </StackPanel>
                                    </Image.ToolTip>
                                </Image>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal"></VirtualizingStackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <MyControl:ScrollableListBox.BorderBrush>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Color="Transparent" Offset="0.0" />
                        <GradientStop Color="SkyBlue" Offset="0.25" />
                        <GradientStop Color="SkyBlue" Offset="0.75" />
                        <GradientStop Color="Transparent" Offset="1.0" />
                    </LinearGradientBrush>
                </MyControl:ScrollableListBox.BorderBrush>
            </MyControl:ScrollableListBox>
            <Button x:Name="butCallAppendixPanel" DockPanel.Dock="Top" Click="butCallAppendixPanel_Click"
                        HorizontalAlignment="Right" Margin="0 0 10 0">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Path StrokeThickness="1.500000" Stroke="#ffffffff" StrokeMiterLimit="1.000000" 
              Fill="Blue"
              Data="F1 M 9.816406,1.694336 L 12.351074,6.830078 L 18.018066,7.654297 L 13.918457,11.654297 L 14.886230,17.299805 L 9.816406,14.630859 L 4.746094,17.299805 L 5.713867,11.654297 L 1.611328,7.654297 L 7.281250,6.830078 L 9.816406,1.694336 Z" 
              HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="Star"/>
                        <TextBlock Margin="1 0 1 0"  Text="Appendix" TextAlignment="Center" VerticalAlignment="Center" />
                    </StackPanel>
                </Button.Content>
            </Button>
            <CommonControl:AppendixPanel x:Name="appendixPanel" Height="0"/>
        </DockPanel>
        <StackPanel Background="#FF333333" Opacity="0.95" 
                    Visibility="Hidden" x:Name="maskLayer" 
                    MouseLeftButtonDown="maskLayer_MouseLeftButtonDown"
                    Panel.ZIndex="2"/>
    </Grid>
</MPL:BaseFadeDialog>
